package com.babyqiao.wallpaper.portal.service.impl;

import com.babyqiao.wallpaper.portal.dao.CategoryPageMapper;
import com.babyqiao.wallpaper.portal.entity.vo.AlbumResVO;
import com.babyqiao.wallpaper.portal.service.ICategoryPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author QLZ
 * @date 2021/3/1
 */
@Service
public class CategoryPageServiceImpl implements ICategoryPageService {
    @Autowired
    CategoryPageMapper categoryPageMapper;
    /**
     * 分页获取热门专辑
     *
     * @param current : 当前页
     * @param limit   : 每页显示条数
     * @Author QLZ
     * @Date 2021/3/1
     * @return: java.util.List<com.babyqiao.wallpaper.portal.entity.vo.AlbumResVO>
     */
    @Override
    @Cacheable(value = "AlbumHotContent", key = "#current", sync = true)
    public List<AlbumResVO> findalbumWithHotService(long current, long limit) {
        List<AlbumResVO> albumResVOS= categoryPageMapper.selectAlbumWithHot(current,limit);
        return albumResVOS;
    }

    /**
     * 分页获取人气专辑
     *
     * @param current : 当前页
     * @param limit   : 每页显示条数
     * @Author QLZ
     * @Date 2021/3/1
     * @return: java.util.List<com.babyqiao.wallpaper.portal.entity.vo.AlbumResVO>
     */
    @Override
    @Cacheable(value = "AlbumLikeContent", key = "#current", sync = true)
    public List<AlbumResVO> findalbumWithLikeService(long current, long limit) {
        List<AlbumResVO> albumResVOS= categoryPageMapper.selectAlbumWithLike(current,limit);
        return albumResVOS;
    }

    /**
     * 分页获取最新专辑
     *
     * @param current : 当前页
     * @param limit   : 每页显示条数
     * @Author QLZ
     * @Date 2021/3/1
     * @return: java.util.List<com.babyqiao.wallpaper.portal.entity.vo.AlbumResVO>
     */
    @Override
    @Cacheable(value = "AlbumNewContent", key = "#current", sync = true)
    public List<AlbumResVO> findalbumWithNewService(long current, long limit) {
        List<AlbumResVO> albumResVOS= categoryPageMapper.selectAlbumWithNew(current,limit);
        return albumResVOS;
    }

}
